import numpy as np

arr = np.arange(24)
print(arr)
# 获取维度/秩
print(arr.ndim)
print(arr.size)
print(arr.shape)
print(arr.dtype)
arr2 = arr.reshape(2, 3, 4)
print(arr2, arr2.ndim)

arr3 = np.array([[1, 2, 3], [4, 5, 6]])
arr3.shape = (3, 2)
print(arr3, arr3.ndim, arr3.shape)

arr4 = np.array([1, 2, 3], dtype='i1')
# 打印出数组中每个元素的大小（以字节为单位）
print(arr4.itemsize)
arr5 = np.array([1, 2, 3], dtype='i8')
print(arr5.itemsize)

# flags 属性包含了关于数组存储和内存布局的信息
print(arr5.flags)